//
//  LZGrouponModel.m
//  laziz_Merchant
//
//  Created by xbn_iMac on 2016/12/21.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import "LZGrouponModel.h"
#import "LZDateFormatterManager.h"
#import "MJProperty.h"

@implementation LZGrouponModel

- (id)mj_newValueFromOldValue:(id)oldValue property:(MJProperty *)property
{
    if ([oldValue isKindOfClass:[NSNull class]]){
        return @"";
    }
    
    if ([property.name isEqualToString:@"grouponStartDaytime"] || [property.name isEqualToString:@"grouponEndDaytime"]) {
        if (oldValue != nil) {
            NSString *ss = (NSString *)oldValue;
            if (ss.length > 0) {
                return [[LZDateFormatterManager shareInstance] stringFromStringNormalHaveLineHHmm:ss];
            }
        }
    }
    
    return oldValue;
}

// 获取团购类型每天的有效期
- (NSString*)getGroupEverydayValid {
    NSString *everyDayValid = nil;
    if ([LZLanguageManager shareInstance].getLanguageType == LanguageType_Ar) {
        everyDayValid = [NSString stringWithFormat:@"%@ - %@",self.grouponEndDaytime,self.grouponStartDaytime];
    }
    else {
        everyDayValid = [NSString stringWithFormat:@"%@ - %@",self.grouponStartDaytime,self.grouponEndDaytime];
    }
    return everyDayValid;
}
@end
